const str = '1234567'

const convertMoney = str => {
  let reg = /\d{1,3}(?=(\d{3})+$)/g
  let newArr = str.replace(reg, '$&,')
  return newArr
}

console.log(convertMoney(str))